<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .d1,
        .d2,
        .d3 {
            position: fixed;
            left: 0;
            top: 0;
            width: 200px;
            height: 200px;
            background-color: green;
        }
        /* 借助z-index 属性,调整定位元素的层级 */
        /* 初始值0 */
        /* 整数,无限大 */
        /* 值越大,层级越高 */

        /* 只有定位元素,才能设置 z-index */

        .d1 {
            z-index: 7;
        }

        .d2 {
            left: 30px;
            top: 30px;
            background-color: blue;
            z-index: 2;
        }

        .d3 {
            left: 80px;
            top: 80px;
            background-color: red;
            z-index: 0;
        }
        /* 格式化快捷键  shift + ctrl +f  */
    </style>
</head>

<body>
    <div class="d1"> d1 </div>
    <div class="d2"> d2 </div>
    <div class="d3"> d3 </div>
</body>

</html>